package com.springboot.framework.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.springboot.framework.dao.entity.OrderDetail;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Author SWF
 * @Date 2019/6/9 23:01
 **/
@Data
public class OrderModel {

    /** 订单id */
    private String id;

    /** 店铺id*/
    private Integer shopId;

    /** 用户id */
    private Integer userId;

    /** 用户openid */
    private String userWechatOpenid;

    /** 买家姓名 */
    private String userName;

    /** 买家手机号 */
    private String userPhone;

    /** 买家地址 */
    private String userAddress;

    /** 备注 */
    private String remark;

    /** 订单总额 */
    private BigDecimal orderAmount;

    /** 优惠券 */
    private Integer userCouponsId;

    /** 优惠券金额 */
    private BigDecimal couponsAmount;

    /** 应支付总额 */
    private BigDecimal payableAmount;

    /** 订单状态  0新订单 1完结 2已取消 */
    private Byte orderStatus;

    /** 支付状态  0未支付  1已支付 */
    private Byte payStatus;

    private List<OrderDetailModel> orderDetailModels;

    private Integer createBy;

    private Date createDate;

    private Integer updateBy;

    private Date updateDate;


    private String shopContact;

    private String type;

    public void convertType() {
        switch (orderStatus) {
            case 0:
                this.type = "unpaid";
                break;
            case 1:
                this.type = "back";
                break;
            case 2:
                this.type = "unreceived";
                break;
            case 3:
                this.type = "completed";
                break;
            case 4:
                this.type = "refunds";
                break;
            default:
                this.type = "";
        }
    }

}
